<?php include "../public/header.php";?>
<?php include "../public/header_public.php";?>
<link rel='stylesheet' href='/static/admin/css/home.css'>
<style>
    .xm-label-block{border: unset!important;}
    .xm-label-block span{font-size: 18px!important;}
    .xm-icon-close{display: none!important;}
    .leftbid .caitong .caibox:hover{background: #f6f6f6 !important;}
</style>
<body id="homePage">
<div id="homeBox">
    <div class="minbox" style="margin-bottom: 10px;padding-top: 10px;height: 40px;">
        <div id="chanid" class="xmselect_div" style="width: 300px;height: 40px;margin-left: 20px"></div>
    </div>
    <div class="leftbid">
        <div class="caitong">
            <div class="caibox"><div class="tit">拟投项目</div><div class="con colorlan" id="pool_num"></div></div>
            <div class="caibox"><div class="tit">立项申请中</div><div class="con colorlan" id="shen_num"></div></div>
            <div class="caibox"><div class="tit">在投项目</div><div class="con colorlan" id="bid_num"></div></div>
            <div class="caibox"><div class="tit">中标项目</div><div class="con colorlan" id="win_num"></div></div>
            <div class="caibox"><div class="tit">未中标项目</div><div class="con colorlan" id="nowin_num"></div></div>
        </div>
        <div class="clear"></div>
        <div class="tabbox float-l">
            <div class="mintab">
                <div class="tits"><b>最近截标项目</b> <span class="nums none" id="bidjie_num">（0）</span></div>
            </div>
            <div class="tablist" id="bidjieDiv">
                <div class="hang hangxian">
                    <div class="cs cs1">工程名称</div>
                    <div class="cs cs2">项目属性</div>
                    <div class="cs cs3">招标方</div>
                    <div class="cs cs4">截标日期</div>
                    <div class="clear"></div>
                </div>
                <div class="conss"><div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div></div>
            </div>
        </div>
        <div class="tabbox float-r" style="width: calc(50% - 25px);">
            <div class="mintab">
                <div class="tits"><b>最近待开标项目</b> <span class="nums none" id="biddai_num">（0）</span></div>
            </div>
            <div class="tablist" id="biddaiDiv">
                <div class="hang hangxian">
                    <div class="cs cs1">工程名称</div>
                    <div class="cs cs2">项目属性</div>
                    <div class="cs cs3">招标方</div>
                    <div class="cs cs4">开标时间</div>
                    <div class="clear"></div>
                </div>
                <div class="conss"><div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div></div>
            </div>
        </div>

        <div class="tabbox float-l">
            <div class="mintab">
                <div class="tits"><b>最近已开标项目</b> <span class="nums none" id="bidkai_num">（0）</span></div>
            </div>
            <div class="tablist" id="bidkaiDiv">
                <div class="hang hangxian">
                    <div class="cs cs1">工程名称</div>
                    <div class="cs cs2">项目属性</div>
                    <div class="cs cs3">招标方</div>
                    <div class="cs cs4">开标结果</div>
                    <div class="clear"></div>
                </div>
                <div class="conss"><div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div></div>
            </div>
        </div>
        <div class="tabbox float-r" style="width: calc(50% - 25px);">
            <div class="mintab">
                <div class="tits"><b>最近中标项目</b> <span class="nums none" id="bidwin_num">（0）</span></div>
            </div>
            <div class="tablist" id="bidwinDiv">
                <div class="hang hangxian">
                    <div class="cs cs1">工程名称</div>
                    <div class="cs cs2">项目属性</div>
                    <div class="cs cs3">招标方</div>
                    <div class="cs cs4">中标价(元)</div>
                    <div class="clear"></div>
                </div>
                <div class="conss"><div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div></div>
            </div>
        </div>
    </div>
    <div class="rightengin" style="height: 734px">
        <div class="tits"><b>投标动态</b></div>
        <div class="chadt">
            <div id="checkchanid" class="layui-hide"></div>
            <input type="text" id="dongdt" readonly placeholder="请选择" autocomplete="off" class="layui-input bdate_dongdt">
        </div>
        <div class="linecon">
            <ul class="layui-timeline" id="dongList"></ul>
        </div>
    </div>

</div>
<script>
    $('.tablist').on('mouseover','.conss .hang',function () {
        $(this).addClass('colorlan');
    }).on('mouseout','.conss .hang',function () {
        $(this).removeClass('colorlan');
    });
    $('#dongList').on('mouseover','p',function () {
        $(this).addClass('colorlan');
    }).on('mouseout','p',function () {
        $(this).removeClass('colorlan');
    });


    layui.use(['form', 'layer', "laytp",'element','dropdown'], function() {
        var form = layui.form, element = layui.element;
        get_bid_chan_home();

        function get_bid_chan_home(chanid=0){
            facade.ajax({url: ask_bid_chan_home, data:{chanid:chanid}}).done(function(res){
                if (res.code === 2000) {
                    var data = res.data;
                    $("#pool_num").html(data.pool_num);
                    $("#shen_num").html(data.shen_num);
                    $("#bid_num").html(data.bid_num);
                    $("#win_num").html(data.win_num);
                    $("#nowin_num").html(data.nowin_num);
                    $("#fei_num").html(data.fei_num);


                    $("#checkchanid").text(res.data.is_chanid);
                    xmselect_dan('chanid', res.data.chanid, res.data.is_chanid, function (res) {
                        get_bid_chan_home(res.change[0].id)
                    });


                    var bidjie_data = res.data.bidjie_data;
                    var bidjie_data_str = '';
                    if(bidjie_data.length > 0){
                        for (var key in bidjie_data){
                            bidjie_data_str += '<div class="hang">';
                            bidjie_data_str += '<div class="cs cs1 colorlan">'+bidjie_data[key].name+'</div>';
                            bidjie_data_str += '<div class="cs cs2">'+bidjie_data[key].business+'</div>';
                            bidjie_data_str += '<div class="cs cs3">'+bidjie_data[key].zhaoname+'</div>';
                            bidjie_data_str += '<div class="cs cs4">'+bidjie_data[key].enddt_tou+'</div>';
                            bidjie_data_str += '<div class="clear"></div>';
                            bidjie_data_str += '</div>';
                        }
                        $("#bidjieDiv .conss").html(bidjie_data_str);
                    }
                    // $("#bidjie_num").html('('+data.bidjie_num+')');


                    var biddai_data = res.data.biddai_data;
                    if(biddai_data.length > 0){
                        var biddai_data_str = '';
                        for (var key in biddai_data){
                            biddai_data_str += '<div class="hang">';
                            bidjie_data_str += '<div class="cs cs1 colorlan">'+biddai_data[key].name+'</div>';
                            bidjie_data_str += '<div class="cs cs2">'+biddai_data[key].business+'</div>';
                            bidjie_data_str += '<div class="cs cs3">'+biddai_data[key].zhaoname+'</div>';
                            bidjie_data_str += '<div class="cs cs4">'+biddai_data[key].kaidt+'</div>';
                            biddai_data_str += '<div class="clear"></div>';
                            biddai_data_str += '</div>';
                        }
                        $("#biddaiDiv .conss").html(biddai_data_str);
                    }
                    // $("#biddai_num").html('('+data.biddai_num+')');


                    var bidkai_data = res.data.bidkai_data;
                    var bidkai_data_str = '';
                    if(bidkai_data.length > 0){
                        for (var key in bidkai_data){
                            bidkai_data_str += '<div class="hang">';
                            bidkai_data_str += '<div class="cs cs1 colorlan">'+bidkai_data[key].name+'</div>';
                            bidkai_data_str += '<div class="cs cs2">'+bidkai_data[key].business+'</div>';
                            bidkai_data_str += '<div class="cs cs3">'+bidkai_data[key].zhaoname+'</div>';
                            bidkai_data_str += '<div class="cs cs4">'+bidkai_data[key].result+'</div>';
                            bidkai_data_str += '<div class="clear"></div>';
                            bidkai_data_str += '</div>';
                        }
                        $("#bidkaiDiv .conss").html(bidkai_data_str);
                    }
                    // $("#bidkai_num").html('('+data.bidkai_num+')')


                    var bidwin_data = res.data.bidwin_data;
                    if(bidwin_data.length > 0){
                        var bidwin_data_str = '';
                        for (var key in bidwin_data){
                            bidwin_data_str += '<div class="hang">';
                            bidwin_data_str += '<div class="cs cs1 colorlan">'+bidwin_data[key].name+'</div>';
                            bidwin_data_str += '<div class="cs cs2">'+bidwin_data[key].business+'</div>';
                            bidwin_data_str += '<div class="cs cs3">'+bidwin_data[key].zhaoname+'</div>';
                            bidwin_data_str += '<div class="cs cs4 txtright">'+parseFormatNum(bidwin_data[key].kai_fee)+'</div>';
                            bidwin_data_str += '<div class="clear"></div>';
                            bidwin_data_str += '</div>';
                        }
                        $("#bidwinDiv .conss").html(bidwin_data_str);
                    }
                    // $("#bidwin_num").html('('+data.bidwin_num+')');

                    get_bid_dong_home();
                    render_from();
                }
            });
        }



        $('.bdate_dongdt').datetimepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            minView: "month",
            initialDate: new Date(),
            autoclose: true,
            todayBtn: true,
        }) .on('changeDate',function (e) {
            get_bid_dong_home($("#dongdt").val())
        });

        function get_bid_dong_home(dt=''){
            var chanid = $("#checkchanid").text();
            facade.ajax({url: ask_bid_dong_home, data:{chanid:chanid, dt:dt}}).done(function(res){
                if (res.code === 2000) {
                    var data = res.data;
                    var list = res.data.data;
                    $("#dongdt").val(data.isdt);

                    var str = '';
                    if(list.length > 0){
                        for (var key in list){
                            str += '<li class="layui-timeline-item">';
                            str += '<i class="layui-icon layui-timeline-axis">&#xe643;</i>';
                            str += '<div class="layui-timeline-content layui-text">';
                            str += '<div class="layui-timeline-title" style="font-size: 14px!important;">';
                            str += list[key].created_time;
                            str += '</div>';
                            str += '<p>'+list[key].name+'</p>';
                            str += '</div>';
                            str += '</li>';
                        }
                    }else{
                        str += '<div class="nodata"><img src="/static/admin/images/welnodata.png" alt=""><div>暂无数据</div></div>';
                    }

                    $("#dongList").html(str);
                    render_from();
                }
            });
        }

    });
</script>
</body>
</html>
